
CC              = gcc
PROC            = $(ORACLE_HOME)/bin/proc
AR              = ar
RM              = -rm
MV              = -mv
CP              = -cp
STRIP           = strip
RANLIB          = ranlib

MYINCDIR				= ../include/

#PROCINC         = include=$(ORACLE_HOME)/precomp/public/ \
#									include=$(ORACLE_HOME)/rdbms/public/ \
#									include=$(ORACLE_HOME)/rdbms/demo/ \
#									include=$(ORACLE_HOME)/plsql/public/ \
#									include=$(ORACLE_HOME)/network/public/

DEBUG_FLAGS			= -g

ORACLE_CFLAGS		= -I$(ORACLE_HOME)/precomp/public/ \
									-I$(ORACLE_HOME)/rdbms/demo/ \
									-I$(ORACLE_HOME)/rdbms/public/ \
									-I$(ORACLE_HOME)/plsql/public/ \
									-I$(ORACLE_HOME)/network/public/

ORACLE_LFLAGS		= -L$(ORACLE_HOME)/lib -lclntsh

PFLAGS          = include=$(MYINCDIR)
CFLAGS          = $(DEBUG_FLAGS) $(ORACLE_CFLAGS) -I$(MYINCDIR)
LFLAGS          = $(ORACLE_LFLAGS)
AFLAGS          = -rv

#ORA_OPT         = PARSE=NONE RELEASE_CURSOR=YES MODE=ANSI


######## implicit rules #########
# .pc: Pro*c, .ppc: Pro*c Package (두 파일의 컴파일 옵션을 나누기 위해 임의로 구분)
ORAUSERID       = id/pwd@sid

.SUFFIXES: .pc .ppc .c
.pc.o:
	$(PROC) $(PFLAGS) iname=$*.pc
	$(CC) -c $(CFLAGS) $*.c
.ppc.o:
	$(PROC) $(PFLAGS) iname=$*.ppc SQLCHECK=SEMANTICS USERID=$(ORAUSERID)
	$(CC) -c $(CFLAGS) $*.c
.c.o:
	$(CC) -c $(CFLAGS) $*.c

PPSRC           =
PSRC            = 25p.pc

####### build rules ########
PPOBJ           = $(PPSRC:.ppc=.o)
POBJ            = $(PSRC:.pc=.o)

TARGET          = 25p

all : $(TARGET)

$(TARGET) : $(POBJ) $(PPOBJ)
	$(CC) -o $@ $(POBJ) $(PPOBJ) $(LFLAGS)
	$(RM) tp*

clean :
	$(RM) $(TARGET) $(POBJ) $(PPOBJ) *.lis *.c *~ tp*

tags :
	ctags -R --langmap=c:.pc.c *.c ../include/*.h
